﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataTool;

namespace Common
{
    public class TaskNotifyClass
    {
        public string Cont { get; set; }
        public int TaskKind { get; set; }
        public string Username { get; set; }
        public void NewNotify()
        {
            wfdbEntities db = new wfdbEntities();
            var n = new NOTIFICATION
            {
                Cont = "loại đơn: " + db.TASKKINDs.Where(x => x.Id == TaskKind).FirstOrDefault().Description + " ---- " + Cont,
                IsNew = true,
                Username = Username,
                date = DateTime.Now,
                Id = Guid.NewGuid()
            };
            db.NOTIFICATIONs.AddObject(n);
            db.SaveChanges();
        }
    }
    public class ContestNotifyClass
    {
        public string Cont { get; set; }
        public string Username { get; set; }
        public void NewNotify()
        {
            wfdbEntities db = new wfdbEntities();
            var n = new NOTIFICATION
            {
                Cont = Cont,
                IsNew = true,
                Username = Username,
                date = DateTime.Now,
                Id = Guid.NewGuid()
            };
            db.NOTIFICATIONs.AddObject(n);
            db.SaveChanges();
        }
    }
}
